\<template>
  <div id="examinpaper_addTitleContainer" class="container" style="padding-top: 0rem;">
    <input type="file" id="file" accept="audio/*" hidden multiple />
    <div class="content">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item
          class="title"
          style=" font-size: 0.2rem;"
          :to="{ path: '/evaluation_manage/examinpaper_manage' }"
        >试卷管理</el-breadcrumb-item>
        <el-breadcrumb-item class="title" style=" font-size: 0.2rem;">{{addTitle_title}}</el-breadcrumb-item>
      </el-breadcrumb>
      <div class="addTitleBox">
        <div class="addTitle_number">第{{titleIndex}}题</div>
        <div class="subject_info">
          <div class="subject_info_tips">题目信息：</div>
          <div class="subject_info_from">
            <el-form label-width="140px">
              <el-form-item label="标题" :rules="[
      { required: true, message: ''}]">
                <el-input
                  ref="title"
                  style="width:60%"
                  clearable
                  v-model="currentTitleData.title"
                  placeholder="请输入标题内容"
                ></el-input>
              </el-form-item>
              <el-form-item label="正文">
                <wangeditor
                  ref="wangeditor"
                  style="width:60%;"
                  contenteditable="true"
                  editorId="examinpaperEdit"
                  :catchData="(d)=>{
                    currentTitleData.content = d;
                  }"
                ></wangeditor>
              </el-form-item>
              <el-form-item>
                <el-button
                  type="primary"
                  style="width:1.4rem;height:0.41rem;"
                  :disabled="currentTitleData.fileList && currentTitleData.fileList.length>=5"
                  @click="selectSubjectFile(currentTitleData.fileList.length)"
                >上传音频</el-button>
              </el-form-item>
              <el-form-item
                label
                v-if="currentTitleData.fileList && currentTitleData.fileList.length >0"
              >
                <el-tag
                  v-for="file in currentTitleData.fileList"
                  :key="file.name"
                  closable
                  @close="handleClose(file,currentTitleData.fileList)"
                >{{file.name}}</el-tag>
              </el-form-item>
            </el-form>
          </div>
        </div>
        <div class="subject_info">
          <div class="subject_info_tips">问题信息：</div>
          <div class="subject_info_from" v-for="item,index in currentTitleData.questions">
            <el-form label-width="140px">
              <el-form-item
                :label="'问题'+(index+1)"
                :rules="[
      { required: true, message: ''}]"
              >
                <el-input
                  style="width:60%"
                  :ref="item.title"
                  clearable
                  v-model="item.title"
                  placeholder="请输入问题内容"
                ></el-input>

                <el-button
                  type="primary"
                  style="width:1.4rem;height:0.41rem;"
                  :disabled="item.fileList.length >=5"
                  @click="selectFile(index,item.fileList.length)"
                >上传音频</el-button>
                <div class="close" @click="deleteQusetion(item)"></div>
              </el-form-item>
              <el-form-item label v-if="item.fileList.length >0">
                <el-tag
                  v-for="file in item.fileList"
                  :key="file.name"
                  closable
                  @close="handleClose(file,item.fileList)"
                >{{file.name}}</el-tag>
              </el-form-item>
              <div style="overflow: hidden;">
                <el-form-item
                  label="题型"
                  style="float:left;width:30%"
                  :rules="[
      { required: true, message: ''}]"
                >
                  <el-select
                    :ref="item.type"
                    style="width:90%"
                    v-model="item.type"
                    clearable
                    placeholder="请选择题型"
                  >
                    <el-option
                      v-for="item in questionTypeList"
                      :key="item.value"
                      :label="item.name"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item
                  label="测评维度"
                  style="float:left;width:30%"
                  :rules="[
      { required: true, message: ''}]"
                >
                  <el-select
                    :ref="item.dimensionId"
                    style="width:90%"
                    v-model="item.dimensionId"
                    clearable
                    placeholder="请选择测评维度"
                  >
                    <el-option
                      v-for="item in dimensionList"
                      :key="item.dimensionId"
                      :label="item.name"
                      :value="item.dimensionId"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item
                  label="分值"
                  style="float:left;width:30%"
                  :rules="[
      { required: true, message: ''}]"
                >
                  <el-input-number
                    :ref="item.score"
                    controls-position="right"
                    class="newclassroomNumber"
                    style="width:90%;"
                    v-model="item.score"
                    :min="0"
                    :max="99999"
                    placeholder="请输入总分"
                  ></el-input-number>
                </el-form-item>
              </div>
              <el-form-item
                label="选项"
                v-if="item.type == 1"
                :rules="[
      { required: true, message: ''}]"
              >
                <div class="option">
                  <table class="table" cellspacing="0" style="table-layout:fixed;">
                    <thead class="thead">
                      <tr>
                        <td style="width: 10rem;">选项内容</td>
                        <td style="width: 2rem;">正确答案</td>

                        <td style="width: 4rem;">操作</td>
                      </tr>
                    </thead>
                    <tbody class="tbody">
                      <tr v-for="answer,answerIndex in item.answers">
                        <td>
                          {{charCode[answerIndex]}}&nbsp;&nbsp;
                          <el-input
                            style="width:80%"
                            clearable
                            :ref="answer.answerTitle"
                            v-model="answer.title"
                            placeholder="请设置选项内容"
                          ></el-input>
                        </td>
                        <td>
                          <!-- <el-input-number
                            v-if="item.type == 2"
                            controls-position="right"
                            class="newclassroomNumber"
                            style="width:2rem;"
                            v-model="answer.score"
                            :min="0"
                            :max="99999"
                            placeholder="分值"
                          ></el-input-number>-->
                          <el-radio v-model="item.isCorrect" :label="answerIndex">&nbsp;</el-radio>
                        </td>
                        <td>
                          <span class="operate_btn" @click="deleteAnswer(item,answerIndex)">删除&nbsp;</span>
                          <span
                            class="operate_btn"
                            v-if="answerIndex == item.answers.length-1 && answerIndex<25"
                            @click="addAnswer(item)"
                          >添加选项</span>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </el-form-item>
            </el-form>
          </div>
          <el-button class="add_subject" @click="addQusetion()">+ 添加问题</el-button>
        </div>
      </div>
      <div class="foot_div animated">
        <el-button
          type="primary"
          style="width:1.4rem;margin-left:0.5rem;"
          @click="nextSubject(true)"
          v-if="hasApi('examinpaperAddSubject')"
        >保存</el-button>
        <el-button type="primary" style="width:1.4rem;" @click="preview()">预览</el-button>
        <el-button
          type="primary"
          style="width:1.4rem;"
          v-if="!isFromPreviewAdd && hasApi('examinpaperAddSubject')"
          @click="nextSubject(false)"
        >{{subjectId?"下一题":"添加下一题"}}</el-button>
      </div>
    </div>
    <el-dialog
      title="正在上传 "
      :visible.sync="dialogFormVisible"
      width="56%"
      :close-on-click-modal="false"
    >
      <div>
        <table class="table" cellspacing="0">
          <thead class="thead">
            <tr>
              <td style="width: 4rem;">文件名称</td>
              <td style="width: 4rem;">文件大小</td>
              <td style="width: 6rem;">上传进度</td>
            </tr>
          </thead>
          <tbody class="tbody">
            <tr v-for="item in fileList" :key="item.uuid">
              <td>{{item.name}}</td>
              <td>{{(item.size/(1024*1024)).toFixed(2)}}M</td>
              <td>
                <el-progress
                  :text-inside="true"
                  :stroke-width="20"
                  :percentage="item.downloadProgress"
                  :color="item.dowmloadStatus"
                ></el-progress>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </el-dialog>
  </div>
</template>

<script>
var vm, user, $file;
import wangeditor from "../operation_manage/common/wangeditor";
export default {
  components: { wangeditor },
  data: function() {
    return {
      dialogFormVisible: false,
      uploader: null, //web直传服务
      baseUrl: "https://bj.bcebos.com/v1/alphakids/paper/", //文件夹路径
      bosInfo: {}, //bos信息
      fileList: [],
      currentUploadQuestionIndex: 0,
      titleIndex: 0,
      paperId: "",
      subjectId: "",
      dimensionList: [],
      currentTitleData: {},
      questionTypeList: [],
      charCode: [],
      isFromPreviewAdd: false,
      isUploadSubject: false,
      uploadNum: 0,
      addTitle_title: ""
    };
  },
  methods: {
    /**删除题目 */
    deleteQusetion(item) {
      vm.currentTitleData.questions.splice(
        vm.currentTitleData.questions.indexOf(item),
        1
      );
      if (vm.currentTitleData.questions.length == 0) {
        vm.addQusetion();
      }
    },
    /**删除选项 */
    deleteAnswer(item, index) {
      item.answers.splice(index, 1);
    },
    /**添加选项 */
    addAnswer(item) {
      item.answers.push({
        title: "",
        score: 0,
        isCorrect: 0
      });
    },
    /**预览 */
    preview() {
      vm.nextSubject(null, true);
    },
    /**添加问题 */
    addQusetion() {
      vm.currentTitleData.questions.push({
        title: "",
        content: "",
        sound: "",
        video: "",
        fileList: [],
        dimensionId: "",
        type: "",
        score: "",
        level: 2,
        ageStart: "1",
        ageEnd: "1",
        isCorrect: 0,
        time: 60,
        answers: [
          {
            title: "",
            score: 0,
            isCorrect: 0
          },
          {
            title: "",
            score: 0,
            isCorrect: 0
          },
          {
            title: "",
            score: 0,
            isCorrect: 0
          },
          {
            title: "",
            score: 0,
            isCorrect: 0
          }
        ]
      });
    },
    /** 下一题 */
    nextSubject(isBack, isPreview) {
      var rules = [];
      let title = this.$refs.title;
      rules.push({
        judge: vm.currentTitleData.title,
        focus: title,
        tips: "请输入标题"
      });
      let allScore = 0;
      vm.currentTitleData.sound = "";
      vm.currentTitleData.fileList.forEach(file => {
        vm.currentTitleData.sound +=
          vm.currentTitleData.sound == "" ? file.url : "," + file.url;
      });
      vm.currentTitleData.questions.forEach(function(item, index) {
        console.log(vm.$refs[item.score]);
        rules = rules.concat([
          {
            judge: item.title || item.sound,
            focus: vm.$refs[item.title][0],
            tips: "请输入问题内容"
          },
          {
            judge: item.type,
            focus: vm.$refs[item.type][0],
            tips: "请选择题型"
          },
          {
            judge: item.dimensionId,
            focus: vm.$refs[item.dimensionId][0],
            tips: "请选择测评维度"
          },
          {
            judge: item.score,
            focus: vm.$refs[item.score][0],
            tips: "请输入分值"
          }
        ]);
        let questionScore = 0;
        item.answers.forEach(function(answer, answerIndex) {
          answer.isCorrect = 0;
          if (item.type == 3) {
            //若是综合题，校验选项的总分
            questionScore += answer.score;
          } else {
            rules = rules.concat([
              {
                judge: answer.title,
                focus: null,
                tips: "请输入选项" + vm.charCode[answerIndex] + "的内容"
              }
            ]);
          }
        });
        if (item.type == 1 && vm.isRepeat(item.answers)) {
          rules = rules.concat([
            {
              judge: false,
              focus: null,
              tips: "问题" + item.title + "选项中有重复选项，请修改！"
            }
          ]);
        }
        item.sound = "";
        item.fileList.forEach(file => {
          item.sound += item.sound == "" ? file.url : "," + file.url;
        });

        if (item.type == 3) {
        } else {
          //赋值正确答案
          item.answers[item.isCorrect].isCorrect = 1;
        }
        allScore += item.score;
      });

      if (!tool.validate(rules)) {
        return;
      }
      vm.currentTitleData.score = allScore;
      if (vm.subjectId == undefined) {
        api.examinpaperAddSubject(vm.currentTitleData).then(function(data) {
          if (data.resultCode == 2000) {
            if (isBack && isBack != null) {
              var path = vm.$store.state.permit["103"].path;
              //传递参数
              vm.$router.push({
                path: path
              });
              vm.$message({
                message: "添加成功",
                type: "success"
              });
            } else if (!isBack && isBack != null) {
              vm.initData();
            }
            if (isPreview) {
              var path = vm.$store.state.permit["105"].path;
              //传递参数
              vm.$router.push({
                path: path,
                query: {
                  paperId: vm.paperId
                }
              });
            }
          } else {
            vm.$message.error(data.message);
          }
        });
      } else {
        api.examinpaperUpdateSubject(vm.currentTitleData).then(function(data) {
          if (data.resultCode == 2000) {
            if (isBack && isBack != null) {
              var path = vm.$store.state.permit["103"].path;
              //传递参数
              vm.$router.push({
                path: path
              });
              vm.$message({
                message: "编辑成功",
                type: "success"
              });
            } else if (!isBack && isBack != null) {
              vm.initUpdateData(vm.currentTitleData.subjectId, 1);
            }
            if (isPreview) {
              var path = vm.$store.state.permit["105"].path;
              //传递参数
              vm.$router.push({
                path: path,
                query: {
                  paperId: vm.paperId
                }
              });
            }
          } else {
            vm.$message.error(data.message);
          }
        });
      }
    },
    isRepeat(arr) {
      var hash = {};
      for (var i in arr) {
        console.log(hash);
        if (hash[arr[i].title]) {
          return true;
        }
        hash[arr[i].title] = true;
      }
      return false;
    },
    initUpdateData(subjectId, queryType) {
      api
        .examinpaperSubjectInfo({
          subjectId: subjectId,
          paperId: vm.paperId,
          queryType: queryType
        })
        .then(function(data) {
          if (data.resultCode == 2000) {
            if (data.list && data.list != null) {
              $file.val("");
              vm.titleIndex++;
              data.list.fileList = [];
              if (data.list.sound && data.list.sound != "") {
                let soundArr = data.list.sound.split(",");
                for (let i = 0; i < soundArr.length; i++) {
                  // let
                  data.list.fileList.push({
                    name: soundArr[i].substring(
                      soundArr[i].lastIndexOf("/") + 1
                    ),
                    url: soundArr[i]
                  });
                }
              }
              data.list.questions.forEach(item => {
                item.fileList = [];
                item.isCorrect = 0;
                item.dimensionId = parseInt(item.dimensionId);
                item.answers.forEach((answer, index) => {
                  if (answer.isCorrect == "1") {
                    item.isCorrect = index;
                    return;
                  }
                });
                if (item.sound && item.sound != "") {
                  let soundArr = item.sound.split(",");
                  for (let i = 0; i < soundArr.length; i++) {
                    // let
                    item.fileList.push({
                      name: soundArr[i].substring(
                        soundArr[i].lastIndexOf("/") + 1
                      ),
                      url: soundArr[i]
                    });
                  }
                }
              });
              vm.currentTitleData = data.list;
              vm.$refs.wangeditor.initContent(data.list.content);
            } else {
              vm.addTitle_title = "添加题目";
              vm.initData();
            }
          } else {
            vm.$message.error(data.message);
          }
        });
    },
    initData() {
      $file.val("");
      vm.titleIndex++;
      vm.uploadNum = 0;
      vm.$refs.wangeditor.initContent("");
      vm.currentTitleData = {
        paperId: vm.paperId,
        title: "",
        content: "",
        sound: "",
        fileList: [],
        video: "",
        score: "",
        level: 2,
        dimensionId: "1",
        time: 60,
        organizationId: user.orgId,
        questions: [
          {
            title: "",
            content: "",
            sound: "",
            video: "",
            fileList: [],
            dimensionId: "",
            type: "",
            score: "",
            level: 2,
            ageStart: "1",
            ageEnd: "1",
            isCorrect: 0,
            time: 60,
            answers: [
              {
                title: "",
                score: 0,
                isCorrect: 0
              },
              {
                title: "",
                score: 0,
                isCorrect: 0
              },
              {
                title: "",
                score: 0,
                isCorrect: 0
              },
              {
                title: "",
                score: 0,
                isCorrect: 0
              }
            ]
          }
        ]
      };
      if (vm.isFromPreviewAdd) {
        console.log("isFromPreviewAdd");
        vm.currentTitleData.subjectId = vm.subjectId;
      }
      vm.subjectId = undefined;
    },
    /**
     * 获取服务
     */
    getUpLoader() {
      vm.uploader = new baidubce.bos.Uploader({
        browse_button: "#file",
        bos_bucket: vm.bosInfo.bucketName, //bucket名
        bos_endpoint: vm.bosInfo.endpoint, //域名
        bos_ak: vm.bosInfo.accessKeyId, //临时ak
        bos_sk: vm.bosInfo.secretAccessKey, //临时sk
        uptoken: vm.bosInfo.sessionToken, //临时token
        max_file_size: "5Gb", //最大上传大小
        bos_multipart_min_size: "500M", //分块上传最小文件大小
        chunk_size: "100M", //分块上传每块上传的大小
        init: {
          PostInit: function() {
            // uploader 初始化完毕之后，调用这个函数
            console.log("uploader 初始化完毕之后");
          },
          Key: function(_, file) {
            console.log("上传之前", file);
            // file.name =
            let fileUrl = "";
            if (vm.isUploadSubject) {
              fileUrl =
                "paper/" + vm.paperId + "/" + vm.titleIndex + "/" + file.name;
            } else {
              fileUrl =
                "paper/" +
                vm.paperId +
                "/" +
                vm.currentUploadQuestionIndex +
                "/" +
                file.name;
            }
            return fileUrl;
          },
          FilesAdded: function(_, files) {
            // 当文件被加入到队列里面，调用这个函数
            console.log("文件被加入FilesAdded", files);
          },
          FilesFilter: function(_, files) {
            console.log("文件被加入FilesFilter", files);
            // 如果需要对加入到队列里面的文件，进行过滤，可以在
            // 这个函数里面实现自己的逻辑
            // 返回值需要是一个数组，里面保留需要添加到队列的文件
            if (files.length > 5) {
              return [];
            } else {
              if (files.length + vm.uploadNum > 5) {
                return [];
              } else {
                return files;
              }
            }
          },
          FileUploaded: function(_, file, info) {
            let currentDownFile = {};
            for (let i = 0; i < vm.fileList.length; i++) {
              if (vm.fileList[i].uuid == file.uuid) {
                currentDownFile = vm.fileList[i];
              }
            }
            if (currentDownFile.uuid == undefined) return;
            tool.message({
              showClose: true,
              message: file.name + "上传成功",
              type: "success"
            });
            currentDownFile.dowmloadStatus = "#67C23A";
            if (vm.isUploadSubject) {
              vm.currentTitleData.fileList.push({
                name: currentDownFile.name,
                url:
                  vm.baseUrl +
                  vm.paperId +
                  "/" +
                  vm.titleIndex +
                  "/" +
                  file.name
              });
            } else {
              vm.currentTitleData.questions[
                vm.currentUploadQuestionIndex
              ].fileList.push({
                name: currentDownFile.name,
                url:
                  vm.baseUrl +
                  vm.paperId +
                  "/" +
                  vm.currentUploadQuestionIndex +
                  "/" +
                  file.name
              });
            }
            vm.$forceUpdate();
            if (vm.uploadOk()) {
              vm.dialogFormVisible = false;
            }
          },
          UploadComplete: function() {},
          BeforeUpload: function(_, file) {
            console.log("上传初始化", file);
            if (vm.bosInfo.minFileSize > file.size) {
              return false;
            }
            let currentDownFile = {};
            for (let i = 0; i < vm.fileList.length; i++) {
              if (vm.fileList[i].uuid == file.uuid) {
                currentDownFile = vm.fileList[i];
              }
            }
            if (currentDownFile.uuid == undefined) return false;
            // if (file.type == "application/zip") {
            //   return false;
            // }

            // 当某个文件开始上传的时候，调用这个函数
            // 如果想组织这个文件的上传，请返回 false
          },
          UploadProgress: function(_, file, progress, event) {
            var re = /([0-9]+\.[0-9]{2})[0-9]*/;
            let bosProgress = Math.round(progress * 100) / 100;
            let currentDownFile = {};
            for (let i = 0; i < vm.fileList.length; i++) {
              if (vm.fileList[i].uuid == file.uuid) {
                currentDownFile = vm.fileList[i];
              }
            }
            currentDownFile.downloadProgress = parseInt(bosProgress * 100);
            vm.$forceUpdate();
            // 文件的上传进度
          },
          NetworkSpeed: function(_, bytes, time, pendings) {
            var speed = bytes / time; // 上传速度
            var leftTime = pendings / speed; // 剩余时间
          },
          UploadPartProgress: function(_, file, progress, event) {
            // 分片上传的时候，单个分片的上传进度
          },
          ChunkUploaded: function(_, file, result) {
            // 分片上传的时候，单个分片上传结束
          },
          Error: function(_, error, file) {
            console.log("上传失败", error);
            let currentDownFile = {};
            for (let i = 0; i < vm.fileList.length; i++) {
              if (vm.fileList[i].uuid == file.uuid) {
                currentDownFile = vm.fileList[i];
              }
            }
            currentDownFile.dowmloadStatus = "#F56C6C";
            // 如果上传的过程中出错了，调用这个函数
            tool.message({
              showClose: true,
              message: "上传失败，请刷新页面再试！",
              type: "error"
            });
            vm.$forceUpdate();
          },
          UploadResume: function(_, file, partList, event) {
            // 断点续传生效时，调用这个函数，partList表示上次中断时，已上传完成的分块列表
          },
          UploadResumeError: function(_, file, error, event) {
            // 尝试进行断点续传失败时，调用这个函数
          }
        }
      });
    },
    uploadOk: function() {
      for (let i = 0; i < vm.fileList.length; i++) {
        if (vm.fileList[i].downloadProgress != 100) {
          return false;
        }
      }
      return true;
    },
    handleClose(file, list) {
      list.splice(list.indexOf(file), 1);
    },
    /**大题正文上传音频 */
    selectSubjectFile(num) {
      vm.uploadNum = num;
      console.log(vm.uploadNum);
      vm.isUploadSubject = true;
      $file.val("");
      $file.click();
    },
    /**小题题目上传音频 */
    selectFile(index, num) {
      vm.uploadNum = num;
      console.log(vm.uploadNum);
      vm.isUploadSubject = false;
      vm.currentUploadQuestionIndex = index;
      $file.val("");
      $file.click();
    }
  },
  mounted() {
    vm.paperId = this.$route.query.paperId;
    vm.subjectId = this.$route.query.subjectId;
    let index = this.$route.query.index;
    let isFromPreview = this.$route.query.isFromPreview;
    if (index) {
      if (isFromPreview) {
        vm.titleIndex = index;
        vm.isFromPreviewAdd = true;
      } else {
        vm.titleIndex = index - 1;
      }
    }
    $file = $("#file");
    $file.change(function() {
      var list = $file[0].files;
      if (list.length > 5) {
        tool.message({
          showClose: true,
          message: "音频文件上传上限为5个",
          type: "worning"
        });
      } else {
        if (vm.uploadNum > 5) {
          return;
        } else {
          console.log(list.length);
          console.log(vm.uploadNum);
          if (list.length + vm.uploadNum > 5) {
            tool.message({
              showClose: true,
              message: "音频文件上传上限为5个",
              type: "worning"
            });
            return;
          }
        }
        for (let i = 0; i < list.length; i++) {
          list[i].downloadProgress = 0;
          list[i].dowmloadStatus = "#409EFF";
        }
        vm.fileList = [];
        vm.fileList = list;

        vm.dialogFormVisible = true;
        vm.$nextTick(function() {
          vm.uploader.start();
        });
      }
    });
    if (vm.subjectId == undefined) {
      vm.addTitle_title = "添加题目";
      vm.initData();
    } else {
      vm.addTitle_title = "编辑题目";
      if (isFromPreview) {
        vm.initData();
      } else {
        vm.initUpdateData(vm.subjectId, 0);
      }
    }
    let paras = {
      tempAccessKeyId: vm.bosInfo.accessKeyId,
      tempSecretAccessKey: vm.bosInfo.secretAccessKey,
      tempSessionToken: vm.bosInfo.sessionToken
    };
    //校验stsToken
    api.checkValidityOfSTSToken(paras).then(function(data) {
      if (data.resultCode == 2000) {
        //如果token失效，则保存新的token
        if (data.info.validityOfStsToken) {
          data.info.bosStsTokenInfo.minFileSize = vm.bosInfo.minFileSize;
          data.info.bosStsTokenInfo.maxFileSize = vm.bosInfo.maxFileSize;
          vm.bosInfo = data.info.bosStsTokenInfo;
          //保存到缓存
          tool.setItem(lsKey.stsToken, data.info.bosStsTokenInfo, true);
          vm.uploader = null;
        }
        vm.getUpLoader();
      } else {
        vm.$message.error(data.message);
      }
    });
  },
  created: function() {
    vm = this;
    //获取数据字典
    let dicdata = tool.getItem(lsKey.dict, true);
    vm.charCode = config.charCode;
    vm.questionTypeList = dicdata["question_type_mode"];
    let stsToken = tool.getItem(lsKey.stsToken, true); //百度云信息
    vm.bosInfo = stsToken;
    if (vm.bosInfo && vm.bosInfo != null) {
    } else {
      tool.message({
        showClose: true,
        message: "系统内部出错，请联系管理员",
        type: "error"
      });
    }
    api.dimensionList({}).then(function(data) {
      if (data.resultCode == 2000) {
        data.list.forEach(item => {
          item.dimensionId = parseInt(item.dimensionId);
        });
        console.log(data.list);
        vm.dimensionList = data.list;
      } else {
        vm.$message.error(data.message);
      }
    });
    user = tool.getItem(lsKey.user, true); //得到当前用户信息
  }
};
</script>
<style lang="scss">
#examinpaper_addTitleContainer {
  .el-form-item__label {
    font-size: 0.16rem;
    color: #666666;
  }

  .w-e-text-container p {
    color: #000000;
    font-size: 18px;
  }


  .el-checkbox__label {
    font-size: 0.16rem;
    color: #666666;
  }

  .el-breadcrumb__separator {
    color: #999999;
  }
  .el-breadcrumb__inner.is-link {
    font-weight: 300;
    color: #333333;
  }
  .el-breadcrumb__inner.is-link:hover {
    color: #3885f8;
  }
  .el-breadcrumb__item:last-child .el-breadcrumb__inner {
    color: #3885f8;
  }
  .newclassroomNumber {
    .el-input__inner {
      border-radius: 0.04rem !important;
    }
  }
  .el-dialog__title {
    line-height: 0.28rem;
    font-size: 0.22rem;
    color: #333333;
  }
  .el-dialog {
    border-radius: 0.1rem;
  }
  .el-dialog__headerbtn {
    font-size: 0.28rem;
  }
  .el-form-item__label {
    font-size: 0.16rem;
    color: #666666;
  }
  .el-checkbox__label {
    font-size: 0.16rem;
    color: #666666;
  }
  .el-radio__label {
    font-size: 0.16rem;
  }
  .el-checkbox {
    margin-right: 0.1rem;
  }
  .el-tag {
    font-size: 0.16rem;
    margin-bottom: 0.06rem;
  }
  .el-tag + .el-tag {
    margin-left: 0.1rem;
  }
  .el-form-item {
    margin-bottom: 0.1rem;
  }
  .tip {
    padding-top: 0.04rem;
    padding-left: 0rem;
    color: #999999;
  }
  .addTitleBox {
    font-size: 0.16rem;
    color: #666666;

    margin-bottom: 0.4rem;
    .addTitle_number {
      font-size: 0.24rem;
      color: #333333;
      font-weight: 500;
      margin-bottom: -0.08rem;
    }

    .subject_info {
      margin-top: 0.16rem;
      .subject_info_tips {
        font-size: 0.2rem;
        color: #333333;
        font-weight: 500;
      }
      .subject_info_from {
        margin-top: 0.1rem;
        background: #ffffff;
        padding: 0.2rem 0rem;
        border-radius: 0.06rem;
        .close {
          float: right;
          width: 0.25rem;
          height: 0.25rem;
          background-image: url(../../assets/img/clue_manage/close.png);
          background-size: 0.16rem;
          background-repeat: no-repeat;
          background-position: center center;
          margin-right: 0.4rem;
          cursor: pointer;
        }
        .wangeditorBox .w-e-text-container {
          height: 3rem !important;
        }
        .option {
          width: 90%;
          border: 1px solid #dcdfe6;
          .el-radio__inner {
            width: 0.2rem;
            height: 0.2rem;
          }
        }
      }
      .add_subject {
        margin: 0.2rem 0rem;
        border: 1px solid #3885f8;
        width: 100%;
        color: #3885f8;
      }
    }
  }
  .foot_div {
    position: absolute;
    z-index: 2;
    width: 90%;
    bottom: 0.3rem;

    opacity: 1;
    text-align: center;
  }
}
</style>
<style scoped src="@/style/module/table.css"></style>
<style scoped src="@/style/clue_manage/clue_manage.css"></style>
<style scoped>
</style>
